package com.lzx.reggie.common

data class R<T>(var code: Int, var msg: String?, var data: T?) {

    private var map = hashMapOf<String, Any>()

    fun add(key:String,obj:Any): R<T> {
        map[key] = obj
        return this
    }
    companion object {
        fun <T> success(obj: T): R<T> {
            return R(1, null, obj)
        }

        fun  error(msg: String?): R<Any> {
            return R(0, msg,null)
        }
    }

}